package org.wgc.study.job;

import org.springframework.batch.item.database.ItemPreparedStatementSetter;
import org.wgc.study.vo.User;

import java.sql.PreparedStatement;
import java.sql.SQLException;

/***
 *@title UserPreStatementSetter
 *@description <TODO description class purpose>
 *@author wgc_j
 *@version 1.0.0
 *@create 2025-08-06 14:23
 **/

//写入数据库需要操作insert sql， 使用预编译就需要明确指定参数值
public class UserPreStatementSetter implements ItemPreparedStatementSetter<User> {
    @Override
    public void setValues(User item, PreparedStatement ps) throws SQLException {
        ps.setString(1, item.getName());
        ps.setInt(2, item.getAge());
        ps.setString(3, item.getEmail());
    }
}
